<?php
// globals.php
session_start();

define('DB_HOSTNAME','localhost');
define('DB_USERNAME','root');
define('DB_PASSWORD','');
define('DB_TABLE_LOGIN','login_tb2011');
define('DB_TABLE_USER_INFO','userdata_tb2011');
define('DB_TABLE_CHICKS','chicks');
define('DB_TABLE_NEWS','news');
define('DB_TABLE_GROUPS', 'groups');
define('DB_NAME','gofish_db');

function DisplayError($message) {
printf ("<H3><FONT SIZE=\"4\" COLOR=\"#CC0000\">%s</FONT></H3>\n", $message);
}

function connectToDB() {
$link=mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);

if (!($link))
	{
	DisplayError(sprintf("erreur lors de la connexion a %s, en tant qu'utilisateur", $hostname, $username));
	DisplayError(sprintf("$link"));
	return 0;
	}

$dbselect=mysql_select_db(DB_NAME, $link); 

if (!($dbselect))
	{
	DisplayError(sprintf("erreur lors de la selection de la base de donnees %s", DB_NAME));
	DisplayError(sprintf("erreur : %d %s", mysql_errno($link), mysql_error($link)));
	return 0;
	}	

return 1;
}

connectToDB();

?>